# -*- coding: utf-8 -*-
"""
Created on 2021-09-30 09:37:56
---------
@summary:
---------
@author: weijiatong
"""

import feapder
import json

class ListSpider(feapder.AirSpider):
    def start_requests(self):
        headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
            'Cookie':'sid=sem_pz_bdpc_dasou_title; __g=sem_pz_bdpc_dasou_title; Hm_lvt_194df3105ad7148dcf2b98a91b5e727a=1632993246; wt2=DanyuDYJRglVcNfoMMfsHo50BSdHuxht6CGQwrc0eN4Zk86T-23636RW0-uhLuNYY88_WrrIPVfvd1ajpVHzexw~~; __l=l=%2Fwww.zhipin.com%2Fweb%2Fgeek%2Frecommend&r=https%3A%2F%2Fwww.baidu.com%2Fother.php%3Fsc.060000K1B4sjdqR8fXWc9N9aGuFPMelQQYM0em2yaKk1FeuV8X370k8YAAwRmw_9wJA1rqthRB92uMJAKBkjmr_p6fPut3WOLxSGt3XHuecjx1GP40oJfE_B1B2BKIxyTM_d5-QjnMZxg-sk43fTcIgzgXY1IgDazedonKQJaCU8qACOdgw8Xp3J1guV2Ir8Go25f6ctZ_IllCYE6kzsF8BniOqo.7D_NR2Ar5Od663rj6t8AGSPticrtXFBPrM-kt5QxIW94UhmLmry6S9wiGyAp7BEIu80.TLFWgv-b5HDkrfK1ThPGujYknHb0THY0IAYqmhq1Tqpkko60IgP-T-qYXgK-5H00mywxIZ-suHY10ZIEThfqmhq1Tqpkko60ThPv5HD0IgF_gv-b5HDdnW6YPjmvn160UgNxpyfqnHf1nHn4nj00UNqGujYknjbLrHR1rfKVIZK_gv-b5HDznWT10ZKvgv-b5H00pywW5R9rf6KspyfqPfKWpyfqPHc0mLFW5HcznH0v%26ck%3D3960.2.144.407.169.381.158.288%26dt%3D1632993239%26wd%3Dboss%25E7%259B%25B4%25E8%2581%2598%26tpl%3Dtpl_12273_25897_20875%26l%3D1528446638%26us%3DlinkName%253D%2525E6%2525A0%252587%2525E9%2525A2%252598-%2525E4%2525B8%2525BB%2525E6%2525A0%252587%2525E9%2525A2%252598%2526linkText%253DBOSS%2525E7%25259B%2525B4%2525E8%252581%252598%2525E2%252580%252594%2525E2%252580%252594%2525E6%252589%2525BE%2525E5%2525B7%2525A5%2525E4%2525BD%25259C%2525EF%2525BC%25258C%2525E6%252588%252591%2525E8%2525A6%252581%2525E8%2525B7%25259F%2525E8%252580%252581%2525E6%25259D%2525BF%2525E8%2525B0%252588%2525EF%2525BC%252581%2526linkType%253D&g=%2Fwww.zhipin.com%2F%3Fsid%3Dsem_pz_bdpc_dasou_title&s=3&friend_source=0&s=3&friend_source=0; _bl_uid=nqkhquyF62pqgn175751ha3jLRab; Hm_lpvt_194df3105ad7148dcf2b98a91b5e727a=1632993277; __c=1632993246; __a=29270946.1632993246..1632993246.5.1.5.5; __zp_stoken__=0138dGndHYicNMHwmAy12MCAQL3NsYHpPBz5JYxQ8GFBiVGdZezhqLCZ2GmtNMXB%2BTxwJVQgkJDA1EkwVSnF5KTM5PXF9MDZBP2s%2BWnAVdzxse004RUEXQjhvKhwzGFw1DSU7fXVbUEcKIRY%3D; acw_tc=0bcb2f1916329952255818161e4edc24a5c12084b2bb7465905e461a6792df; geek_zp_token=V1QNskFuL02lprVtRvzB8RIC636jzVxy4~; __zp_sseed__=ubFQpMileEgTQxYhlrmIgfoVF6gfICwJE5XeALHxruw=; __zp_sname__=e948d594; __zp_sts__=1632995256038'
        }
        # params = {
        #     'expectId', '9eee2e7e54d3de5a1HR60t68FFZZ',
        #     'sortType', '1',
        #     'page', '1',
        #     'salary', '',
        #     'payType', '',
        #     'degree', '',
        #     'experience', '',
        #     'stage', '',
        #     'scale', '',
        #     'districtCode', '0',
        #     'businessCode', '',
        # }
        url ='https://www.zhipin.com/wapi/zpgeek/recommend/job/list.json?'

        yield feapder.Request(url =url,headers=headers,callback=self.parse_list)

    def parse_list(self, request, response):
        response_list=response
        job_list = response_list.text
        job_list1=json.loads(job_list)['zpData']
        print(job_list1)
        print(job_list1['zpData'])
        print(response_list.text)

        bossname=job_list1['bossName']
        # jobName=job_list1['jobName']
        # salaryDesc=job_list1['salaryDesc']
        # jobLabels=job_list1['jobLabels']


        print(bossname)
        print('*'*20)




if __name__ == "__main__":
    ListSpider().start()